﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Framework.UI.Controls"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Geometry.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/FocusVisualStyle.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Validation.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/Watermark.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!-- ButtonSpinner -->
    <Style TargetType="{x:Type controls:ButtonSpinner}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="IsTabStop" Value="True"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ButtonSpinner}">
                    <ControlTemplate.Resources>
                        <DataTemplate x:Key="PathContentTemplate">
                            <Path Height="4"
                                  Data="{Binding}"
                                  Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type RepeatButton}}}"
                                  Stretch="Uniform" 
                                  Width="16"/>
                        </DataTemplate>
                    </ControlTemplate.Resources>
                    <Border x:Name="Border" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            SnapsToDevicePixels="True">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <ContentPresenter Focusable="False" 
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{TemplateBinding Padding}" 
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                            <Grid x:Name="PART_Buttons" 
                                  Grid.Column="1">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>

                                <RepeatButton x:Name="PART_IncreaseButton"
                                              Content="{StaticResource ArrowHeadUpGeometry}"
                                              ContentTemplate="{StaticResource PathContentTemplate}"
                                              IsTabStop="{TemplateBinding IsTabStop}"
                                              MinWidth="20"
                                              Padding="6, 0, 6, 0"/>

                                <RepeatButton x:Name="PART_DecreaseButton"
                                              Grid.Row="1"
                                              Content="{StaticResource ArrowHeadDownGeometry}"
                                              ContentTemplate="{StaticResource PathContentTemplate}"
                                              IsTabStop="{TemplateBinding IsTabStop}"
                                              MinWidth="20"
                                              Padding="6, 0, 6, 0"/>

                            </Grid>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ShowButtonSpinner" Value="False">
                            <Setter Property="Visibility" TargetName="PART_Buttons" Value="Collapsed"/>
                        </Trigger>
                        <!--<Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{StaticResource {x:Static themes:ResourceKeys.ControlDisabledBackgroundKey}}"/>
                        </Trigger>-->
                        <!--<Trigger SourceName="PART_IncreaseButton" Property="IsEnabled" Value="False">
                            <Setter TargetName="PART_IncreaseButton" Property="ContentTemplate" Value="{StaticResource IncreaseGlyphDisabledKey}"/>
                        </Trigger>
                        <Trigger SourceName="PART_DecreaseButton" Property="IsEnabled" Value="False">
                            <Setter TargetName="PART_DecreaseButton" Property="ContentTemplate" Value="{StaticResource DecreaseGlyphDisabledKey}"/>
                        </Trigger>-->
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorControlTemplate}"/>
                <Setter Property="Background" Value="{StaticResource ValidationErrorBrush}"/>
                <Setter Property="ToolTip" Value="{StaticResource ValidationErrorToolTip}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- NumericUpDown -->
    <Style x:Key="NumericUpDown" TargetType="{x:Type controls:InputBase}">
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}"/>
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.DefaultThickness), Mode=OneWay}"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="TextAlignment" Value="Right"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.DefaultPadding), Mode=OneWay}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="WatermarkTemplate" Value="{StaticResource DefaultWatermarkTemplate}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Control">
                    <controls:ButtonSpinner x:Name="PART_Spinner"
                                            AllowSpin="{Binding AllowSpin, RelativeSource={RelativeSource TemplatedParent}}"
                                            IsTabStop="False"
                                            ShowButtonSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}">
                        <controls:TextBoxExtended x:Name="PART_TextBox"
                                                  Background="{TemplateBinding Background}"
                                                  BorderThickness="{TemplateBinding BorderThickness}"
                                                  ContextMenu="{TemplateBinding ContextMenu}"
                                                  FontFamily="{TemplateBinding FontFamily}" 
                                                  FontSize="{TemplateBinding FontSize}" 
                                                  FontStretch="{TemplateBinding FontStretch}"
                                                  FontStyle="{TemplateBinding FontStyle}" 
                                                  FontWeight="{TemplateBinding FontWeight}" 
                                                  Foreground="{TemplateBinding Foreground}" 
                                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
                                                  MinWidth="20"
                                                  AcceptsReturn="False"
                                                  AutoMoveFocus="{Binding Path=AutoMoveFocus, RelativeSource={RelativeSource TemplatedParent}}"
                                                  Padding="{TemplateBinding Padding}"
                                                  SelectAllOnGotFocus="{Binding SelectAllOnGotFocus, RelativeSource={RelativeSource TemplatedParent}}"
                                                  TextAlignment="{Binding TextAlignment, RelativeSource={RelativeSource TemplatedParent}}"
                                                  TextWrapping="NoWrap" 
                                                  TabIndex="{TemplateBinding TabIndex}"
                                                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  Watermark="{Binding Watermark, RelativeSource={RelativeSource TemplatedParent}}"
                                                  WatermarkTemplate="{Binding WatermarkTemplate, RelativeSource={RelativeSource TemplatedParent}}"/>
                    </controls:ButtonSpinner>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorControlTemplate}"/>
                <Setter Property="Background" Value="{StaticResource ValidationErrorBrush}"/>
                <Setter Property="ToolTip" Value="{StaticResource ValidationErrorToolTip}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style TargetType="{x:Type controls:DecimalUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentDecimalUpDownStyle" BasedOn="{StaticResource {x:Type controls:DecimalUpDown}}" TargetType="{x:Type controls:DecimalUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:DoubleUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentDoubleUpDownStyle" BasedOn="{StaticResource {x:Type controls:DoubleUpDown}}" TargetType="{x:Type controls:DoubleUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:IntegerUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentIntegerUpDownStyle" BasedOn="{StaticResource {x:Type controls:IntegerUpDown}}" TargetType="{x:Type controls:IntegerUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:ShortUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentShortUpDownStyle" BasedOn="{StaticResource {x:Type controls:ShortUpDown}}" TargetType="{x:Type controls:ShortUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:LongUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentLongUpDownStyle" BasedOn="{StaticResource {x:Type controls:LongUpDown}}" TargetType="{x:Type controls:LongUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:ByteUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentByteUpDownStyle" BasedOn="{StaticResource {x:Type controls:ByteUpDown}}" TargetType="{x:Type controls:ByteUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:SingleUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentSingleUpDownStyle" BasedOn="{StaticResource {x:Type controls:SingleUpDown}}" TargetType="{x:Type controls:SingleUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:SByteUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentSByteUpDownStyle" BasedOn="{StaticResource {x:Type controls:SByteUpDown}}" TargetType="{x:Type controls:SByteUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:UIntegerUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentUIntegerUpDownStyle" BasedOn="{StaticResource {x:Type controls:UIntegerUpDown}}" TargetType="{x:Type controls:UIntegerUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:ULongUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentULongUpDownStyle" BasedOn="{StaticResource {x:Type controls:ULongUpDown}}" TargetType="{x:Type controls:ULongUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>
    <Style TargetType="{x:Type controls:UShortUpDown}" BasedOn="{StaticResource NumericUpDown}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsRedOnNegative" Value="True"/>
                    <Condition Property="IsNegative" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{StaticResource NegativeActionBrush}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="TransparentUShortUpDownStyle" BasedOn="{StaticResource {x:Type controls:UShortUpDown}}" TargetType="{x:Type controls:UShortUpDown}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>

</ResourceDictionary>